package com.panghu.controller;


import com.panghu.entity.ApiResult;
import com.panghu.entity.JudgeQuestion;
import com.panghu.service.impl.JudgeQuestionServiceImpl;
import com.panghu.utils.ApiResultHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 判断题题库表 前端控制器
 * </p>
 *
 * @author huahua
 * @since 2022-03-19
 */
@RestController
public class JudgeQuestionController {


        @Autowired
        private JudgeQuestionServiceImpl judgeQuestionService;

        @PostMapping("/judgeQuestion")
        public ApiResult add(@RequestBody JudgeQuestion judgeQuestion) {
            //添加判断题题
            boolean save = judgeQuestionService.save(judgeQuestion);
            if(save){
                return ApiResultHandler.buildApiResult(200,"添加成功",save);
            }else {
                return ApiResultHandler.buildApiResult(400,"添加失败",save);
            }
        }

        @GetMapping("/judgeQuestionId")
        public ApiResult findOnlyQuestionId() {
            //按id查询判断题
            return ApiResultHandler.success(judgeQuestionService.findOnlyQuestionId());
        }

}

